package com.itcast.flink.screen.database.bo;

import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Transient;

/**
 * <p>Description: </p>
 * @date 
 * @author 
 * @version 1.0
 * <p>Copyright:Copyright(c)2020</p>
 */
@Data
public class JoinOrderPayment {

    /**
     * 唯一主键标识
     */
    private Long id;

    public static JoinOrderPayment build(Order order, OrderPaymentResult orderPayment) {
        JoinOrderPayment joinOrderPayment = new JoinOrderPayment();
        BeanUtils.copyProperties(order, joinOrderPayment);
        joinOrderPayment.setStatus(orderPayment.getStatus());
        joinOrderPayment.setUpdateTime(orderPayment.getUpdateTime());
        return joinOrderPayment;
    }

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 商品ID
     */
    private Long goodsId;

    /**
     * 商品名称
     */
    private String goodsName;

    /**
     * 成交金额
     */
    private Long execPrice;

    /**
     * 成交数量
     */
    private Integer execVolume;

    /**
     * 成交时间
     */
    private Long execTime;

    /**
     * 总成交金额
     */
    @Transient
    private Long totalAmount;

    /**
     * 订单支付状态, 0:未支付，1：已支付, 2: 取消, 3: 超时
     */
    private Integer status;

    /**
     * 订单更新时间
     */
    private Long updateTime;

}
